package com.baidu.bean;

import com.baidu.Car2;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class InheritTheCar2 {
    protected static ApplicationContext applicationContext;

    @BeforeClass
    public static void testCode() {
        applicationContext = new ClassPathXmlApplicationContext("applicationContext2.xml");

        System.out.println();
    }

    //    测试Bean注解@Component
    @Test
    public void testGetBeanFromAnn(){
        Car2 car2 = applicationContext.getBean("Car2", Car2.class);
        car2.getEngine().running();
        System.out.println("car2 = " + car2);
        System.out.println();
    }
}
